home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / tpwin31.zip / CPL.PAS < prev    next >
Pascal/Delphi Source File  |  1992-04-06  |  5KB  |  164 lines

  1. {*******************************************************}
  2. {                                                       }
  3. {       Turbo Pascal for Windows Run-time Library       }
  4. {       Windows 3.1 API Interface Unit                  }
  5. {       Control panel extension DLL definitions         }
  6. {                                                       }
  7. {       Copyright (c) 1992 Borland International        }
  8. {                                                       }
  9. {*******************************************************}
  10. {******************************************************************************
  11. *  General rules for being installed in the Control Panel:
  12. *
  13. *      1) The DLL must export a function named CPlApplet which will handle
  14. *         the messages discussed below.
  15. *      2) If the applet needs to save information in CONTROL.INI minimize
  16. *         clutter by using the application name [MMCPL.appletname].
  17. *      2) If the applet is refrenced in CONTROL.INI under [MMCPL] use
  18. *         the following form:
  19. *              ...
  20. *              [MMCPL]
  21. *              uniqueName=c:\mydir\myapplet.dll
  22. *              ...
  23. *
  24. *
  25. *  The order applet DLL's are loaded by CONTROL.EXE is:
  26. *
  27. *      1) MAIN.CPL is loaded from the windows system directory.
  28. *
  29. *      2) Installable drivers that are loaded and export the
  30. *         CplApplet() routine.
  31. *
  32. *      3) DLL's specified in the [MMCPL] section of CONTROL.INI.
  33. *
  34. *      4) DLL's named *.CPL from windows system directory.
  35. *
  36. }
  37.  
  38. {
  39.  * CONTROL.EXE will answer this message and launch an applet
  40.  *
  41.  * WM_CPL_LAUNCH
  42.  *
  43.  *      wParam      - window handle of calling app
  44.  *      lParam      - LPSTR of name of applet to launch
  45.  *
  46.  * WM_CPL_LAUNCHED
  47.  *
  48.  *      wParam      - TRUE/FALSE if applet was launched
  49.  *      lParam      - NULL
  50.  *
  51.  * CONTROL.EXE will post this message to the caller when the applet returns
  52.  * (ie., when wParam is a valid window handle)
  53.  *
  54.  }
  55.  
  56. unit Cpl;
  57.  
  58. interface
  59.  
  60. uses WinTypes;
  61.  
  62. const
  63.   wm_CPL_Launch   = wm_User+1000;
  64.   wm_CPL_Launched = wm_User+1001;
  65.  
  66. { A function prototype for CPlApplet() }
  67.  
  68. type
  69.   TApplet_Proc = function(hWndCpl: HWnd; msg: Word;
  70.     lParam1, lParam2: Longint): Longint;
  71.  
  72. { The data structure CPlApplet() must fill in. }
  73.  
  74. type
  75.   PCPLInfo = ^TCPLInfo;
  76.   TCPLInfo = record
  77.     idIcon: Integer;     { icon resource id, provided by CPlApplet() }
  78.     idName: Integer;     { name string res. id, provided by CPlApplet() }
  79.     idInfo: Integer;     { info string res. id, provided by CPlApplet() }
  80.     lData: Longint;      { user defined data }
  81.   end;
  82.  
  83. type
  84.   PNewCPLInfo = ^TNewCPLInfo;
  85.   TNewCPLInfo = record
  86.     dwSize: Longint;                   { similar to the commdlg }
  87.     dwFlags: Longint;
  88.     dwHelpContext: Longint;            { help context to use }
  89.     lData: Longint;                    { user defined data }
  90.     Icon: HIcon;          { icon to use, this is owned by CONTROL.EXE (may be deleted) }
  91.     szName: array[0..31] of Char;      { short name }
  92.     szInfo: array[0..63] of Char;      { long name (status line) }
  93.     szHelpFile: array[0..127] of Char; { path to help file to use }
  94.   end;
  95.  
  96.  
  97. { The messages CPlApplet() must handle: }
  98.  
  99. const
  100.   cpl_Init        = 1;
  101. {  This message is sent to indicate CPlApplet() was found. }
  102. {  lParam1 and lParam2 are not defined. }
  103. {  Return TRUE or FALSE indicating whether the control panel should proceed. }
  104.  
  105.  
  106. const
  107.   cpl_GetCount    = 2;
  108. {  This message is sent to determine the number of applets to be displayed. }
  109. {  lParam1 and lParam2 are not defined. }
  110. {  Return the number of applets you wish to display in the control }
  111. {  panel window. }
  112.  
  113.  
  114. const
  115.   cpl_Inquire     = 3;
  116. {  This message is sent for information about each applet. }
  117. {  lParam1 is the applet number to register, a value from 0 to }
  118. {  (CPL_GETCOUNT - 1).  lParam2 is a far ptr to a CPLINFO structure. }
  119. {  Fill in CPL_INFO's idIcon, idName, idInfo and lData fields with }
  120. {  the resource id for an icon to display, name and description string ids, }
  121. {  and a long data item associated with applet #lParam1. }
  122.  
  123.  
  124. const
  125.   cpl_Select      = 4;
  126. {  This message is sent when the applet's icon has been clicked upon. }
  127. {  lParam1 is the applet number which was selected.  lParam2 is the }
  128. {  applet's lData value. }
  129.  
  130.  
  131. const
  132.   cpl_DblClk      = 5;
  133. {  This message is sent when the applet's icon has been double-clicked }
  134. {  upon.  lParam1 is the applet number which was selected.  lParam2 is the }
  135. {  applet's lData value. }
  136. {  This message should initiate the applet's dialog box. }
  137.  
  138.  
  139. const
  140.   cpl_Stop        = 6;
  141. {  This message is sent for each applet when the control panel is exiting. }
  142. {  lParam1 is the applet number.  lParam2 is the applet's lData  value. }
  143. {  Do applet specific cleaning up here. }
  144.  
  145.  
  146. const
  147.   cpl_Exit        = 7;
  148. {  This message is sent just before the control panel calls FreeLibrary. }
  149. {  lParam1 and lParam2 are not defined. }
  150. {  Do non-applet specific cleaning up here. }
  151.  
  152.  
  153. const
  154.   cpl_NewInquire  = 8;
  155. { this is the same as CPL_INQUIRE execpt lParam2 is a pointer to a }
  156. { NEWCPLINFO structure.  this will be sent before the CPL_INQUIRE }
  157. { and if it is responed to (return != 0) CPL_INQUIRE will not be sent }
  158.  
  159. implementation
  160.  
  161. end.
  162.  
  163.  
  164.